package fantasyfootball.data.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 * Class: 605.441 
 * Group: Richard Koretke, Kay Jantharasorn, Israel Rivera.
 * 
 * @author Israel Rivera
 * 
 */
@Entity(name="NFLOffenseStats")
public class NFLOffensiveStats implements Serializable{
	
	private static final long serialVersionUID = -6831335299226228021L;
	
	private Integer offensiveStatsID;
	private Integer week;
	private NFLPlayer nflPlayer;
	
	private Integer passingTD;
	private Integer passingYDS;
	private Integer interceptions;
	private Integer rushingTD;
	private Integer rushingYDS;
	private Integer fumbles;
	private Integer receivingTD;
	private Integer receivingYDS;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="OffensiveStatsID", nullable=false)
	public Integer getOffensiveStatsID() {
		return offensiveStatsID;
	}

	public void setOffensiveStatsID(Integer offensiveStatsID) {
		this.offensiveStatsID = offensiveStatsID;
	}

	@Column(name="Week", nullable=false)
	public Integer getWeek() {
		return week;
	}
	
	public void setWeek(Integer week) {
		this.week = week;
	}
	
	@JoinColumn(name="PlayerID", nullable=false)
	@ManyToOne(fetch=FetchType.LAZY, optional=false)
	public NFLPlayer getNflPlayer() {
		return nflPlayer;
	}
	public void setNflPlayer(NFLPlayer nflPlayer) {
		this.nflPlayer = nflPlayer;
	}
	
	@Column(name="PassingTD", nullable=true)
	public Integer getPassingTD() {
		return passingTD;
	}
	
	public void setPassingTD(Integer passingTD) {
		this.passingTD = passingTD;
	}
	
	@Column(name="PassingYDS", nullable=true)
	public Integer getPassingYDS() {
		return passingYDS;
	}
	
	public void setPassingYDS(Integer passingYDS) {
		this.passingYDS = passingYDS;
	}
	
	@Column(name="Interceptions", nullable=true)
	public Integer getInterceptions() {
		return interceptions;
	}
	
	public void setInterceptions(Integer interceptions) {
		this.interceptions = interceptions;
	}
	
	@Column(name="RushingTD", nullable=true)
	public Integer getRushingTD() {
		return rushingTD;
	}
	
	public void setRushingTD(Integer rushingTD) {
		this.rushingTD = rushingTD;
	}
	
	@Column(name="RushingYDS", nullable=true)
	public Integer getRushingYDS() {
		return rushingYDS;
	}
	
	public void setRushingYDS(Integer rushingYDS) {
		this.rushingYDS = rushingYDS;
	}
	
	@Column(name="Fumbles", nullable=true)
	public Integer getFumbles() {
		return fumbles;
	}
	
	public void setFumbles(Integer fumbles) {
		this.fumbles = fumbles;
	}
	
	@Column(name="ReceivingTD", nullable=true)
	public Integer getReceivingTD() {
		return receivingTD;
	}
	
	public void setReceivingTD(Integer receivingTD) {
		this.receivingTD = receivingTD;
	}
	
	@Column(name="ReceivingYDS", nullable=true)
	public Integer getReceivingYDS() {
		return receivingYDS;
	}
	
	public void setReceivingYDS(Integer receivingYDS) {
		this.receivingYDS = receivingYDS;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((offensiveStatsID == null) ? 0 : offensiveStatsID.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		NFLOffensiveStats other = (NFLOffensiveStats) obj;
		if (offensiveStatsID == null) {
			if (other.offensiveStatsID != null)
				return false;
		} else if (!offensiveStatsID.equals(other.offensiveStatsID))
			return false;
		return true;
	}
}